package org.example.com.atguigu.exercise;

import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.SparkSession;

public class Exercise3 {
    public static void main(String[] args) {
        SparkSession spark = SparkSession.builder().master("local[4]").appName("testUdf").getOrCreate();
        Dataset<String> df = spark.read().option("sep", ",").option("header", "false").textFile("E:\\IdeaProject\\bigdata0228\\spark0228\\datas\\stu.txt");

        Dataset<Row> ds = df.toDF("id", "name", "age");
        ds.createOrReplaceTempView("stu");

        spark.sql("select * from stu").show();
    }
}
